cmake_minimum_required(VERSION 3.9)
project(yolov7-ncnn)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

set(OpenCV_DIR $ENV{OPENCV})
set(Vulkan_DIR $ENV{VULKAN})

find_package(Vulkan)
find_package(OpenCV REQUIRED)

include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib/ncnn/x64/include/ncnn)

if(Vulkan_FOUND)
    include_directories(${Vulkan_INCLUDE_DIRS})
endif()

link_directories(${OpenCV_LIBRARY_DIRS})
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib/ncnn/x64/lib)

macro(create_target name)
    add_executable(${name} "src/${name}.cpp")

    target_link_libraries(
        ${name}
        ${OpenCV_LIBS}
        ncnn
    )
endmacro(create_target name)

create_target(yolov7ncnn)
create_target(yolov7pnnx)
